<?php
    require_once("includes/common.inc.php");

    $action = (isset($_GET['action'])) ? $_GET['action'] : '';
    $action = (empty($action) && (isset($_POST['action']))) ? $_POST['action'] : $action;

    $rssSourceUrl = (isset($_POST['source_url'])) ? $_POST['source_url'] : '';
    if (!empty($rssSourceUrl) && $action == 'insert')
    {
        RssInfoManager::InsertUrl($rssSourceUrl);
    }

    $rssSourceId = (isset($_GET['id'])) ? $_GET['id'] : '';
    $rssSourceId = (empty($rssSourceId) && (isset($_POST['id']))) ? $_POST['id'] : $rssSourceId;

    if (!empty($rssSourceId) && $action == 'delete')
    {
        RssInfoManager::Delete($rssSourceId);
    }

    $newUrl = (isset($_POST['new_url'])) ? $_POST['new_url'] : '';
    if (!empty($rssSourceId) && $action == 'update')
    {
        RssInfoManager::UpdateUrl($newUrl, $rssSourceId);
    }